package com.pavco.caribbeanvisit.client.event;

import com.google.gwt.event.shared.GwtEvent;
import com.pavco.caribbeanvisit.shared.models.Country;

public class CountryListBoxChangedEvent extends GwtEvent<CountryListBoxChangedEventHandler> {
  public static final GwtEvent.Type<CountryListBoxChangedEventHandler> TYPE =
      new GwtEvent.Type<CountryListBoxChangedEventHandler>();
  
  private Country selectedCountry;
  
  public CountryListBoxChangedEvent(Country selectedCountry) {
    this.selectedCountry = selectedCountry;
  }

  @Override
  public Type<CountryListBoxChangedEventHandler> getAssociatedType() {
    return TYPE;
  }

  @Override
  protected void dispatch(CountryListBoxChangedEventHandler handler) {
    handler.onChanged(this);
  }
  
  public Country getCountry() {
    return this.selectedCountry;
  }
}